<template>
  <div>
  <basic-container v-if="!templateEditVisible">
    <avue-crud :option="option"
      :table-loading="loading"
      :data="data"
      :page="page"
      ref="crud"
      v-model="form"
      :permission="permissionList"
      :row-style="rowStyle"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @on-load="onLoad"
      @row-save="addRowsave"
    >
      <template slot="menuLeft">
        <!-- <el-popover
          placement="top"
          width="160"
          trigger="click">
          <el-select v-model="qnType" placeholder="请选择问卷类型" @change="handleCreateQn">
            <el-option v-for="x in qnTypeDic" :key="x.value"
            :label="x.label" :value="x.value"></el-option>
          </el-select> -->
          <!-- <el-button slot="reference" type="primary" size="small" icon="el-icon-plus" @click="handleAdd">新增2</el-button> -->
        <!-- </el-popover> -->
        <!-- <el-button type="danger"
          size="small"
          icon="el-icon-delete"
          v-if="permission.menu_delete"
          plain
          @click="handleDelete">删 除
        </el-button> -->
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button v-if="scope.row.status == 1" type="text" size="small" icon="el-icon-edit" @click="handleSee(scope.row)">查看</el-button>
        <el-button v-if="scope.row.status == 2" type="text" size="small" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
        <el-button v-if="scope.row.status == 2" type="text" size="small" icon="el-icon-top" @click="handlePublish(scope.row)">发布</el-button>
        <el-button v-else-if="scope.row.status == 1" type="text" size="small"  @click="handleRecall(scope.row)">撤回</el-button>
        <el-button type="text" size="small" icon="el-icon-document-copy" @click="handleCopy(scope.row)">复制</el-button>
        <!--<el-dropdown style="margin-left: 10px" type="text" size="mini">
          <el-button type="text" size="mini">
            更多<i class="el-icon-arrow-down el-icon--right"></i>
          </el-button>
          <el-dropdown-menu slot="dropdown">
            <!~~ <el-dropdown-item></el-dropdown-item>
            <el-dropdown-item></el-dropdown-item>
            <el-dropdown-item> </el-dropdown-item>
            <el-dropdown-item></el-dropdown-item> ~~>
            <el-dropdown-item><el-button type="text" size="small"  @click="handleResultDesc(scope.row)">结果描述</el-button></el-dropdown-item>
            <el-dropdown-item><el-button type="text" size="small" @click="handleSetanalyse(scope.row)">设置分析项</el-button></el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>-->
      </template>
    </avue-crud>

    <el-dialog
      title="编辑"
      :visible.sync="addDialog"
      width="70%"
      :close-on-click-modal="false"
      :before-close="handleCloseAddDl">

    </el-dialog>
  </basic-container>
  <div class="editAndView" v-if="templateEditVisible">
    <el-button type="warning" icon="el-icon-back" size="small" @click.stop="gobackList">返回列表</el-button>
    <el-tabs v-model="activeName" :before-leave="beforeLeaveTab">
      <el-tab-pane label="基本信息" name="basicInfo">
        <el-form ref="editForm" :model="editForm" size="small" label-width="100px" :rules="formRule" :disabled="isView">
          <el-row>
            <el-col :span="12">
              <el-form-item label="量表分类：" prop="typeId">
                <el-select style="width:100%;" v-model="editForm.typeId" placeholder="请选择量表分类" @change="handleTypeChange">
                  <el-option v-for="x in qnTypeDic" :key="x.value"
                  :label="x.label" :value="x.value"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="第二分类：" prop="typeSonId">
                <el-select style="width:100%;" v-model="editForm.typeSonId" placeholder="请选择第二分类">
                  <el-option v-for="x in typeSon" :key="x.dictId"
                  :label="x.dictName" :value="x.dictId"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="编号：" prop="number">
                <el-input v-model="editForm.number" placeholder="请输入编号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="量表名称：" prop="title">
                <el-input v-model="editForm.title" placeholder="请输入量表中文名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="友好名称：" prop="friendlyTitle">
                <el-input v-model="editForm.friendlyTitle" placeholder="请输入量表英文名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="测验用时(分)：" prop="takeTime" label-width="120px">
                <el-input v-model="editForm.takeTime" placeholder="请输入建议完成量表时间"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="年龄下限：" prop="ageMin">
                <el-input type="number" v-model="editForm.ageMin" placeholder="请输入年龄下限"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="年龄上限：" prop="ageMax">
                <el-input type="number" v-model="editForm.ageMax" placeholder="请输入年龄上限"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="量表简介：" prop="desc">
                <el-input type="textarea" rows="4" v-model="editForm.desc" placeholder="请输入量表简介"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="详细介绍：" prop="details">
                <AvueUeditor :disabled="isView" v-model="editForm.details" :isVmodel="true"/>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="指导语：" prop="instruction">
                <AvueUeditor :disabled="isView" v-model="editForm.instruction" :isVmodel="true"/>
              </el-form-item>
            </el-col>
          </el-row>
          <span style="float: right;margin-bottom: 70px;">
            <el-button type="primary" size="small" :loading="saveLoading" @click="handleSave">保 存</el-button>
          </span>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="试题" name="questions">
        <TemplateEdit ref="templateEdit" :isShowViewSaveBtn="isShowViewSaveBtn" :right="50" :top="180" v-if="templateEditVisible" @on-save="handleTempEidtSave" @on-editsave="handleEveryTopicSave" @on-preview="handlePreview"/>
      </el-tab-pane>
      <el-tab-pane label="因子" name="divisor">
        <AnalysePage ref="analysePage" :isView="isView" :templateId="everyId"></AnalysePage>
      </el-tab-pane>
    </el-tabs>
  </div>
  <AllEdit ref="allEdit" v-if="dialogVisible" :dialogVisible="dialogVisible" :editVal="descEdit" @close="handleClose" @sure="handleAllEditSave"/>
</div>
</template>

<script>
import { editResultDesc, getList, deleteTemplate, getType, publishOrWithdraw, copyTemplate, addOrUpdate, getDetail } from "@/api/platform/templateManage";
import {mapGetters} from "vuex";
import TemplateEdit from './index.vue'
import AllEdit from './allEdit/index2.vue'
import AnalysePage from './analysePage/index.vue'
export default {
  components:{ TemplateEdit, AllEdit, AnalysePage },
  data() {
    return {
      form: {},
      loading: true,
      selectionList: [],
      query: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      option: {
        searchShow: true,
        searchMenuSpan: 6,
        tree: false,
        tip: false,
        border: true,
        index: true,
        selection: true,
        addBtn: true,
        menuWidth: 300,
        editBtn: false,
        viewBtn: false,
        column: [
          {
            label: "编号",
            prop: "number",
            search: false,
            rules: [
              {
                required: false,
                message: "请输入编号",
                trigger: "blur"
              }
            ]
          },
          {
            label: "量表标题",
            prop: "title",
            search: true,
            width: '130',
            rules: [
              {
                required: true,
                message: "请输入量表中文名称",
                trigger: "blur"
              }
            ]
          },
          {
            label: "友好名称",
            prop: "friendlyTitle",
            search: false,
            rules: [
              {
                required: false,
                message: "请输入量表英文名称",
                trigger: "blur"
              }
            ]
          },
          {
            label: "量表类型",
            prop: "typeId",
            search: true,
            type: 'select',
            dicData: [],
            rules: [
              {
                required: true,
                message: "请选择量表类型",
                trigger: "blur"
              }
            ],
            cascader: ['typeSonId'],
          },
          {
            label: "第二分类",
            prop: "typeSonId",
            search: false,
            hide: true,
            type: 'select',
            rules: [
              {
                required: true,
                message: "请选择第二分类",
                trigger: "blur"
              }
            ],
            dicUrl: '/api/ManageQuestTemplate/GetQuestTypeIdList?parentId={{key}}',
            props: {
              label: 'dictName',
              value: 'dictId'
            },
          },
          {
            label: "测试用时参考（分）",
            prop: "takeTime",
            search: false,
            width: '130',
            rules: [
              {
                required: true,
                message: "请输入测试用时参考",
                trigger: "blur"
              }
            ]
          },
          {
            label: "年龄上限",
            prop: "ageMax",
            search: false,
            hide: true,
            type: 'number',
            dicData: [],
            rules: [
              {
                required: false,
                message: "请选择年龄上限",
                trigger: "blur"
              }
            ]
          },
          {
            label: "年龄下限",
            prop: "ageMin",
            search: false,
            hide: true,
            type: 'number',
            dicData: [],
            rules: [
              {
                required: true,
                message: "请选择年龄下限",
                trigger: "blur"
              }
            ]
          },
          {
            label: "量表简介",
            prop: "desc",
            type: "textarea",
            span: 24,
            search: false,
            hide: true,
            dicData: [],
            rules: [
              {
                required: true,
                message: "请选择量表简介",
                trigger: "blur"
              }
            ]
          },
          {
            label: "详细介绍",
            prop: "details",
            component: 'avueUeditor',
            action: '/api/localfiles/uploadPcFile',
            headers: {},
            data: {},
            propsHttp: {
              url: 'link',
              name: 'name',
              res: 'data'
            },
            span: 24,
            hide: true,
          },
          {
            label: "指导语",
            prop: "instruction",
            span: 24,
            component: 'avueUeditor',
            action: '/api/localfiles/uploadPcFile',
            headers: {},
            data: {},
            propsHttp: {
              url: 'link',
              name: 'name',
              res: 'data'
            },
            hide: true,
            rules: [
              {
                required: true,
                message: "请输入指导语",
                trigger: "blur"
              }
            ]
          },
          {
            label: "适用年龄",
            prop: "ageScope",
            search: false,
            display: false,
            formatter: (row) => {
              return row.ageMin + '-' + row.ageMax;
            },
            rules: [
              {
                required: true,
                message: "请输入适用年龄",
                trigger: "blur"
              }
            ]
          },
          {
            label: "题目个数",
            prop: "numberProblems",
            search: false,
            display: false,
            rules: [
              {
                required: true,
                message: "请输入题目个数",
                trigger: "blur"
              }
            ]
          },
          {
            label: "最后修改时间",
            prop: "updateTime",
            display: false,
            width: '130',
          },
          {
            label: "状态",
            prop: "status",
            search: true,
            display: false,
            type: 'select',
            dicData: [
              {
                label: '发布',
                value: 1
              },
              {
                label: '未发布',
                value: 2
              },
            ],
            rules: [
              {
                required: true,
                message: "请选择状态",
                trigger: "blur"
              }
            ]
          }
        ]
      },
      data: [],
      qnTypeDic: [],
      qnType: '',
      visibleStatus: 'add',//add edit view
      templateEditVisible: false,
      dialogVisible: false,
      descEdit: '',
      resDescId: '',
      everyId: '0',

      addDialog: false,
      editForm: {
        typeId: '',
        typeSonId: '',
        number: '',
        title: '',
        friendlyTitle: '',
        takeTime: '',
        ageMin: '',
        ageMax: '',
        desc: '',
        details: '',
        instruction: '',
      },
      activeName: 'basicInfo',
      formRule: {
        typeId: [
          { required: true, message: "请选择类型", trigger: "blur" }
        ],
        typeSonId: [
          { required: true, message: "请选择第二类型", trigger: "blur" }
        ],
        // number: [
        //   { required: true, message: "请选择编号", trigger: "blur" }
        // ],
        title: [
          { required: true, message: "请输入量表名称", trigger: "blur" }
        ],
        // friendlyTitle: [
        //   { required: true, message: "请输入友好名称", trigger: "blur" }
        // ],
        takeTime: [
          { required: true, message: "请选择测试用时", trigger: "blur" }
        ],
        ageMin: [
          { required: true, message: "请输入年龄下限", trigger: "blur" }
        ],
        // ageMax: [
        //   { required: true, message: "请输入年龄上限", trigger: "blur" }
        // ],
        desc: [
          { required: true, message: "请输入描述", trigger: "blur" }
        ],
        instruction: [
          { required: true, message: "请输入指导语", trigger: "blur" }
        ],
      },
      typeSon: [],
      isShowViewSaveBtn: true,
      // 保存模板的题目
      templateTopics: null,
      saveLoading: false
    };
  },

  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.menu_add, false),
        viewBtn: this.vaildData(this.permission.menu_view, false),
        // delBtn: this.vaildData(this.permission.menu_delete, false),
        editBtn: this.vaildData(this.permission.menu_edit, false)
      };
    },
    isView() {
      return this.visibleStatus == 'view'
    }
  },
  methods: {
    handleAdd() {
      this.addDialog = true
    },
    // 控制原生按钮显隐
    rowStyle(col) {
      if (col.row.status == 2) {
        this.option.delBtn = true
      } else if (col.row.status == 1) {
        this.option.delBtn = false
      }
    },
    // 返回列表
    gobackList() {
      this.templateEditVisible = false;
      this.savedClose()
    },
    savedClose() {
      this.qnType = ''
      this.everyId = '0'
      this.editForm = {
        typeId: '',
        typeSonId: '',
        number: '',
        title: '',
        friendlyTitle: '',
        takeTime: '',
        ageMin: '',
        ageMax: '',
        desc: '',
        details: '',
        instruction: '',
      }
      this.templateTopics = null
      this.activeName = 'basicInfo'
      this.isShowViewSaveBtn = true
      this.query = {}
      // this.onLoad(this.page,{})
    },
    // 编辑完成
    handleTempEidtSave(val) {
      this.templateTopics = val
      this.activeName = 'basicInfo'
      // addOrUpdate({ ...val, id: this.everyId }).then(res => {
      //   if (res.data.code == 200) {
      //     this.$message({
      //       type: 'success',
      //       message: res.data.msg || '保存成功'
      //     })
      //   }
      //   this.savedClose()
      // })
    },
    handleCreateQn() {
      this.visibleStatus = 'add'
      this.templateEditVisible = true
      this.$nextTick(() => {
        this.$refs.templateEdit.questionnaire.typeId = this.qnType
      })
    },
    handleSee(row) {
      this.visibleStatus = 'view'
      this.isShowViewSaveBtn = false
      this.everyId = row.id
      // 获取详情
      getDetail({ id: row.id }).then(res => {
        const d = res.data && res.data.data
        const { questDtos, ...formData } = d
        this.editForm = formData
        // 传递值过去
        this.$nextTick(() => {
          const qnn = {
            "title": formData.title,
            "typeId": formData.typeId,
            // "desc": formData.desc,
            "desc": formData.instruction,// 简介实际改为显示指导语
            "resultDesc": formData.resultDesc,
          }
          const qD = (questDtos.length > 0 ? questDtos : [{
            isHover: false,
            isShowEdit: false,
            sortId: 0,
            isOpenInsertDialog: false,
            "title": "分页",
            "titleHint": "",
            "type": 0,
            "isRequired": 1,
            "sort": "1",
            "solutionDtos": [
                {
                    "title": "分页",
                    "sort": 1,
                    "desc": "",
                    "file": ""
                }
            ]
          }]).map(item => {
            delete item.isHover
            return item
          })
          this.templateTopics = { ...qnn, questDtos: qD }

          this.$refs.templateEdit.questionnaire = qnn
          this.$refs.templateEdit.questionnaireList = qD
        })
      }).then(() => {
        // 获取第二分类
        this.getSontype()
      })
      this.templateEditVisible = true
    },
    handleEdit(row) {
      this.visibleStatus = 'edit'
      this.everyId = row.id
      // 获取详情
      getDetail({ id: row.id }).then(res => {
        const d = res.data && res.data.data
        const { questDtos, ...formData } = d
        this.editForm = formData
        // 传递值过去
        this.$nextTick(() => {
          const qnn = {
            "title": formData.title,
            "typeId": formData.typeId,
            // "desc": formData.desc,
            "desc": formData.instruction,// 简介实际改为显示指导语
            "resultDesc": formData.resultDesc,
          }
          const qD = questDtos.length > 0 ? questDtos : [{
            isHover: false,
            isShowEdit: false,
            sortId: 0,
            isOpenInsertDialog: false,
            "title": "分页",
            "titleHint": "",
            "type": 0,
            "isRequired": 1,
            "sort": "1",
            "solutionDtos": [
                {
                    "title": "分页",
                    "sort": 1,
                    "desc": "",
                    "file": ""
                }
            ]
          }]
          this.templateTopics = { ...qnn, questDtos: qD }

          this.$refs.templateEdit.questionnaire = qnn
          this.$refs.templateEdit.questionnaireList = qD
        })
      }).then(() => {
        // 获取第二分类
        this.getSontype()
      })
      this.templateEditVisible = true
    },
    handleCopy(row) {
      copyTemplate({ id: row.id }).then(res => {
        if (res.data.code === 200) {
          this.$message.success('复制成功')
          this.onLoad(this.page, {})
        }
      })
    },
    handlePublish(row) {
      publishOrWithdraw({id: row.id}).then(res=>{
        this.$message({type: 'success', message: res.data.msg || '操作成功'})
        this.onLoad(this.page, {})
      })
    },
    handleRecall(row) {
      publishOrWithdraw({id: row.id}).then(res=>{
        this.$message({type: 'success', message: res.data.msg || '操作成功'})
        this.onLoad(this.page, {})
      })
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return deleteTemplate({id: row.id});
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        this.loading = false;
        this.page.total = res.data.data.total;
        this.data = res.data.data.records;
        this.getDicData()
        this.qnType = ''
      })
    },
    getDicData() {
      getType().then(res => {
        const newData = res.data.data.map(item => {
          return {
            label: item.dictName,
            value: item.dictId,
          }
        })
        const columnData = this.findObject(this.option.column, 'typeId')
        columnData.dicData = newData
        this.qnTypeDic = newData
      })
    },
    // 编辑时量表分类
    handleTypeChange() {
      this.getSontype()
    },
    getSontype() {
      getType({
        parentId: this.editForm.typeId
      }).then(res => {
        this.typeSon = res.data.data
      })
    },
    // 结果描述
    handleResultDesc(row) {
      this.dialogVisible = true
      this.descEdit = row.resultDesc
      this.resDescId = row.id
    },
    handleClose(val) {
      this.dialogVisible = val;
      this.resDescId = ''
    },
    handleAllEditSave(val) {
      editResultDesc({ id: this.resDescId, resultDesc: val.html }).then(res => {
        this.$message.success((res.data.msg || '修改成功'))
        this.onLoad(this.page)
      })
      this.handleClose(false)
    },
    handleEveryTopicSave(val) {
      this.editForm.instruction = val.desc
      addOrUpdate({
        ...val,
        typeId: this.editForm.typeId,
        typeSonId: this.editForm.typeSonId,
        number: this.editForm.number,
        title: this.editForm.title,
        friendlyTitle: this.editForm.friendlyTitle,
        takeTime: this.editForm.takeTime,
        ageMin: this.editForm.ageMin,
        ageMax: this.editForm.ageMax || 0,
        desc: this.editForm.desc,
        details: this.editForm.details,
        instruction: this.editForm.instruction,
        id: this.everyId
      }).then(res => {
          this.everyId = res.data.data
      })
    },
    // 预览
    handlePreview(val) {
      if (this.visibleStatus == 'edit' || this.everyId != 0) {
        this.$router.push({ path: '/templateManage/previewPage', query: { id: this.everyId, type: 1 } })
      } else {
        const d = {
          ...val,
          typeId: this.editForm.typeId,
          typeSonId: this.editForm.typeSonId,
          number: this.editForm.number,
          title: this.editForm.title,
          friendlyTitle: this.editForm.friendlyTitle,
          takeTime: this.editForm.takeTime,
          ageMin: this.editForm.ageMin,
          ageMax: this.editForm.ageMax || 0,
          desc: this.editForm.desc,
          details: this.editForm.details,
          instruction: this.editForm.instruction,
          id: this.everyId
        }
        addOrUpdate(d).then(res => {
          this.everyId = res.data.data
          this.$router.push({ path: '/templateManage/previewPage', query: { id: this.everyId, type: 1 } })
        })
      }
    },
    // 设置分析
    handleSetanalyse(row) {
      this.$router.push({ path: '/templateManage/analysePage', query: { id: row.id } })
    },

    beforeLeaveTab(active) {
      if (active == 'basicInfo') {
        this.getTemplateTopicData()
      }
    },
    getTemplateTopicData() {
      this.$nextTick(() => {
        this.templateTopics = this.$refs.templateEdit.offerQnData()
      })
    },

    // add save
    addRowsave(row, done, loading) {
      console.log('%c December0v0 ','background-image:linear-gradient(135deg,#BC95C6,#18545A);color:#fff;',
        row, done, loading)
      const d = {
        typeId: row.typeId,
        typeSonId: row.typeSonId,
        number: row.number,
        title: row.title,
        friendlyTitle: row.friendlyTitle,
        takeTime: row.takeTime,
        ageMin: row.ageMin,
        ageMax: row.ageMax,
        desc: row.desc,
        details: row.details,
        instruction: row.instruction,
      }
      addOrUpdate(d).then(res => {
        if (res.data.code == 200) {
          this.$message({
            type: 'success',
            message: res.data.msg || '保存成功'
          })
        }
        this.gobackList()
        this.onLoad(this.page,{})
      })
      done()
    },
    // 编辑保存
    handleSave() {
      this.$refs['editForm'].validate(valid => {
        const parse = new DOMParser()
        const h = parse.parseFromString(this.editForm.instruction.replace(/\n|\t/g, ""), 'text/html')
        if (valid && h.body.textContent != '') {
          console.log('%c December0v0 ','background-image:linear-gradient(135deg,#F1F2B5,#8b7042);color:#fff;',
            this.templateTopics, this.editForm)
            this.saveLoading = true
            const d = {
              ...this.templateTopics,
              typeId: this.editForm.typeId,
              typeSonId: this.editForm.typeSonId,
              number: this.editForm.number,
              title: this.editForm.title,
              friendlyTitle: this.editForm.friendlyTitle,
              takeTime: this.editForm.takeTime,
              ageMin: this.editForm.ageMin,
              ageMax: this.editForm.ageMax || 0,
              desc: this.editForm.desc,
              details: this.editForm.details,
              instruction: this.editForm.instruction,
              id: this.everyId,
            }
            // this.editForm.ageMax ? d.ageMax = this.editForm.ageMax : ''
            addOrUpdate(d).then(res => {
              if (res.data.code == 200) {
                this.$message({
                  type: 'success',
                  message: res.data.msg || '保存成功'
                })
              }
              this.gobackList()
            }).finally(() => {
              this.saveLoading = false
            })
        } else {
          this.$message.error('请填写必填项！！！')
          return
        }
      })
    }
  }
};
</script>

<style lang="scss" scoped>
// ::v-deep .el-dialog__body{
//   padding: 0 20px 30px;
// }
.editAndView{
  box-sizing: border-box;
  padding: 0 20px;
  background-color: #fff;
}
</style>
